# 打开文件，存在的文件
f = open('/Users/zhangguoqiang/PycharmProjects/pythonProject/fileDaemon/test1.txt', 'w', encoding="UTF-8")

# write写入
f.write('举头望明月，低头思故乡。')

# flush刷新
f.flush()

# close关闭
f.close()

# 打开一个不存在的文件
f = open('/Users/zhangguoqiang/PycharmProjects/pythonProject/fileDaemon/world.txt', 'w', encoding="UTF-8")
f.write('Hello Python')
f.flush()